package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                                                                                            import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.SmsSendLogMapper;
import com.ruoyi.bizsys.domain.SmsSendLog;
import com.ruoyi.bizsys.service.ISmsSendLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 短信发送日志Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class SmsSendLogServiceImpl extends ServiceImpl<SmsSendLogMapper,SmsSendLog> implements ISmsSendLogService {

    /**
     * 查询短信发送日志
     *
     * @param id 短信发送日志ID
     * @return 短信发送日志
     */
    @Override
    public SmsSendLog selectSmsSendLogById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询短信发送日志列表
     *
     * @param smsSendLog 短信发送日志
     * @return 短信发送日志
     */
    @Override
    public List<SmsSendLog> selectSmsSendLogList(SmsSendLog smsSendLog) {
        return this.list(new QueryWrapper<>(smsSendLog).last("order by id desc"));
    }

    /**
     * 新增短信发送日志
     *
     * @param smsSendLog 短信发送日志
     * @return 结果
     */
            @Override
    public int insertSmsSendLog(SmsSendLog smsSendLog) {
                                                                                                                                                                                                                                                                                                                            smsSendLog.setCreateTime(DateUtils.getNowDate());
                                                                                                            return baseMapper.insert(smsSendLog);
    }

    /**
     * 修改短信发送日志
     *
     * @param smsSendLog 短信发送日志
     * @return 结果
     */
            @Override
    public int updateSmsSendLog(SmsSendLog smsSendLog) {
                                                                                                                                                                                                                                                                                                                                                smsSendLog.setUpdateTime(DateUtils.getNowDate());
                                                                                        return baseMapper.updateById(smsSendLog);
    }

    /**
     * 批量删除短信发送日志
     *
     * @param ids 需要删除的短信发送日志ID
     * @return 结果
     */
            @Override
    public int deleteSmsSendLogByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除短信发送日志信息
     *
     * @param id 短信发送日志ID
     * @return 结果
     */
    @Override
    public int deleteSmsSendLogById(Long id) {
        return baseMapper.deleteById(id);
    }

}
